﻿//-----------------------------------------------------------------------
// <copyright file="ProductValidator.cs" company="FER">
//     Copyright (c) All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace NMBP.View.Validators
{
    using Models;

    /// <summary>
    /// Product validator class
    /// </summary>
    public static class ProductValidator
    {
        /// <summary>
        /// Validates product properties
        /// </summary>
        /// <param name="product">product to be checked</param>
        /// <returns>value indicating whether product validates or not</returns>
        public static bool ValidateProduct(Product product)
        {
            if (product.Description.Length >=60 || product.Description.Length <= 10)
            {
                return false;
            }

            if (product.InStock <= 0)
            {
                return false;
            }

            if (product.Price <= 0)
            {
                return false;
            }

            if (product.Image == null)
            {
                return false;
            }

            return true;
        }
    }
}
